
package com.sgcc.ln.pmos.e_ln_mall.presenter;

import android.text.TextUtils;

import com.sgcc.ln.pmos.common.base.BasePresenter;
import com.sgcc.ln.pmos.common.bean.ComparisonDetailContentBean;
import com.sgcc.ln.pmos.common.bean.ComparisonDetailDataBean;
import com.sgcc.ln.pmos.common.bean.ComparisonDetailTopBean;
import com.sgcc.ln.pmos.common.bean.PackageBean;
import com.sgcc.ln.pmos.common.bean.PackageComparisonBean;
import com.sgcc.ln.pmos.common.bean.PackageComparisonDetailBean;
import com.sgcc.ln.pmos.common.bean.PackageComparisonPriceDetailBean;
import com.sgcc.ln.pmos.common.bean.PackageComparisonSchemeDetailBean;
import com.sgcc.ln.pmos.common.bean.PackageInfoMonthBean;
import com.sgcc.ln.pmos.common.http.HttpInterConst;
import com.sgcc.ln.pmos.common.http.HttpRequestUtils;
import com.sgcc.ln.pmos.common.http.MvpNetCallback;
import com.sgcc.ln.pmos.common.utils.BigDecimalUtils;
import com.sgcc.pmos.nativesdk.R;
import com.sgcc.ln.pmos.common.utils.EnumUtils;
import com.sgcc.ln.pmos.common.utils.TextUtil;
import com.sgcc.ln.pmos.e_ln_mall.bean.ComparisonDetailBackBean;
import com.sgcc.ln.pmos.e_ln_mall.contract.ComparisonDetailContract;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import okhttp3.Call;

public class ComparisonDetailPresenter extends BasePresenter<ComparisonDetailContract.View> implements ComparisonDetailContract.Presenter {

    private List<ComparisonDetailContentBean> comparisonDetailContentBeans = new ArrayList<>();//对比内容
    private List<ComparisonDetailTopBean> comparisonDetailTopBeans = new ArrayList<>();//对比头部数据
    private Map<String, List<PackageInfoMonthBean.Bean>> monthDataMap = new LinkedHashMap<>();//月份对应的数据

    private ArrayList<PackageBean> selectPackageList;

    private ComparisonDetailBackBean comparisonDetailBackBean = new ComparisonDetailBackBean();


    private int monthListPosition = 0;

    private List<Integer> monthSelectIndexList = new ArrayList<>();//选择第几月份

    private List<List<Boolean>> isShowPriceCurve = new ArrayList<>();//是否显示约定价格曲线 0 基准套餐的 1 浮动套餐的


    public void clearData() {
        comparisonDetailContentBeans.clear();
        comparisonDetailTopBeans.clear();
        monthDataMap.clear();
        isShowPriceCurve.clear();
    }

    @Override
    public void getComparisonDetailData(boolean isLoading, ArrayList<PackageBean> selectPackageList, List<Integer> monthSelectIndexList) {
        if (isLoading)
            getView().showLoading();
        this.selectPackageList = selectPackageList;
        this.monthSelectIndexList = monthSelectIndexList;


        List<String> list = new ArrayList<>();
        for (PackageBean packageBean : selectPackageList) {
            list.add(packageBean.getCombId());
        }


        Map<String, Object> params = new HashMap<>();
        params.put("combIds", list);
        params.put("_t", System.currentTimeMillis());

        HttpRequestUtils.getInstance().request(params, HttpInterConst.PACKAGE_COMPARISON,
                new MvpNetCallback<PackageComparisonBean>(getView(), isLoading) {
                    @Override
                    public void onError(Call call, Exception e, int id) {
                        super.onError(call, e, id);
                        // 失败回调 判断界面是否销毁
                        if (!isViewAttached()) {
                            return;
                        }
                        getView().queryFailed();
                    }

                    @Override
                    public void onResponse(PackageComparisonBean response, int id) {
                        super.onResponse(response, id);
                        if (!isViewAttached()) {
                            return;
                        }
                        if (null != response && null != response.getData() && response.getData().size() > 0) {
                            List<String> monthList = new ArrayList<>();
                            for (int i = 0; i < response.getData().size(); i++) {
                                PackageComparisonBean.Bean datum = response.getData().get(i);
                                monthList.add(datum.getCombId());
                                comparisonDetailTopBeans.add(new ComparisonDetailTopBean(
                                        HttpInterConst.BASEURL_IMG + datum.getFileId(),
                                        TextUtil.getName(datum.getSellingPoint(), selectPackageList.get(i).getCreditRating()),
                                        TextUtils.isEmpty(datum.getCombCode()) ?
                                                selectPackageList.get(i).getCombCode() : datum.getCombCode()));
//                                List<Boolean> booleans = new ArrayList<>();
//                                booleans.add((datum.getMainType().equals("01") || datum.getMainType().equals("02")));//分时分电量01，分时不分电量02，不分时分电量03，不分时不分电量04
//                                booleans.add((datum.getFloType().equals("01") || datum.getFloType().equals("02")));//分时分电量01，分时不分电量02，不分时分电量03，不分时不分电量04
//                                isShowPriceCurve.add(booleans);

                            }
                            getMonth(monthList, response, isLoading);//查询月数据

                        }

                    }
                });
    }

    /**
     * 循环请求 月份数据
     *
     * @param combIds
     * @param packageComparisonBean
     * @param isLoading
     */
    private void getMonth(List<String> combIds, PackageComparisonBean packageComparisonBean, boolean isLoading) {

        Map<String, Object> params = new HashMap<>();
        params.put("combId", combIds.get(monthListPosition));
        params.put("_t", System.currentTimeMillis());

        HttpRequestUtils.getInstance().request(params, HttpInterConst.PACKAGE_INFO,
                new MvpNetCallback<PackageInfoMonthBean>(getView(), isLoading) {
                    @Override
                    public void onError(Call call, Exception e, int id) {
                        super.onError(call, e, id);
                        // 失败回调 判断界面是否销毁
                        if (!isViewAttached()) {
                            return;
                        }
                        getView().queryFailed();
                    }

                    @Override
                    public void onResponse(PackageInfoMonthBean response, int id) {
                        super.onResponse(response, id);
                        if (!isViewAttached()) {
                            return;
                        }
                        monthDataMap.put(combIds.get(monthListPosition), response.getData());
                        if (monthListPosition == combIds.size() - 1) {
                            monthListPosition = 0;
                            initData1(packageComparisonBean);
                            List<String> list = new ArrayList<>();
                            int index = 0;
                            for (List<PackageInfoMonthBean.Bean> beanList : monthDataMap.values()) {
                                list.add(beanList.get(monthSelectIndexList.get(index)).getPackageId());
                                index++;
                            }
                            comparisonDetailBackBean.setPackageIdList(new ArrayList<>(list));
                            getPackageComparisonDetail(list, isLoading);
                            return;
                        }
                        monthListPosition++;
                        getMonth(combIds, packageComparisonBean, isLoading);

                    }
                });


    }


    //对比 基本参数
    private void getPackageComparisonDetail(List<String> list, boolean isLoading) {
        Map<String, Object> params = new HashMap<>();
        params.put("packageIds", list);
        params.put("_t", System.currentTimeMillis());

        HttpRequestUtils.getInstance().request(params, HttpInterConst.PACKAGE_COMPARISON_DETAIL,
                new MvpNetCallback<PackageComparisonDetailBean>(getView(), isLoading) {
                    @Override
                    public void onError(Call call, Exception e, int id) {
                        super.onError(call, e, id);
                        // 失败回调 判断界面是否销毁
                        getView().queryFailed();
                    }

                    @Override
                    public void onResponse(PackageComparisonDetailBean response, int id) {
                        super.onResponse(response, id);
                        if (!isViewAttached()) {
                            return;
                        }
                        if (null != response && null != response.getData() && response.getData().size() > 0) {
                            comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.TITLE,
                                    R.mipmap.ic_param, "基本参数"));

                            List<PackageComparisonDetailBean.Bean> data = response.getData();
                            List<String> mainTypeList = new ArrayList<>();
                            List<String> floTypeList = new ArrayList<>();

                            for (PackageComparisonDetailBean.Bean datum : data) {
                                mainTypeList.add(datum.getMainType());
                                floTypeList.add(datum.getFloType());
                            }
                            comparisonDetailBackBean.setMainTypeList(mainTypeList);
                            comparisonDetailBackBean.setFloTypeList(floTypeList);
                            List<ComparisonDetailContentBean.ContentBean> contentBeanList1 = new ArrayList<>();
                            for (String s : list) {//找到对应的数据  传递顺序是123 返回有可能213或者其他需要重新遍历找到对应的
                                for (PackageComparisonDetailBean.Bean datum : data) {
                                    if (!TextUtils.isEmpty(s) && !TextUtils.isEmpty(datum.getPackageId()) && s.equals(datum.getPackageId())) {
                                        contentBeanList1.add(new ComparisonDetailContentBean.ContentBean(-1, getPNum(datum.getPNum())));
                                    }
                                }
                            }
                            comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                                    "商品类型", contentBeanList1));

                            List<ComparisonDetailContentBean.ContentBean> contentBeanList2 = new ArrayList<>();

                            for (String s : list) {//找到对应的数据  传递顺序是123 返回有可能213或者其他需要重新遍历找到对应的
                                for (PackageComparisonDetailBean.Bean datum : data) {
                                    if (!TextUtils.isEmpty(s) && !TextUtils.isEmpty(datum.getPackageId()) && s.equals(datum.getPackageId())) {
                                        contentBeanList2.add(new ComparisonDetailContentBean.ContentBean(-1, datum.getSchemeRatio1() + "%"));
                                    }
                                }
                            }

                            comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                                    "用户向上承担系数", contentBeanList2));

                            List<ComparisonDetailContentBean.ContentBean> contentBeanList3 = new ArrayList<>();
                            for (String s : list) {//找到对应的数据  传递顺序是123 返回有可能213或者其他需要重新遍历找到对应的
                                for (PackageComparisonDetailBean.Bean datum : data) {
                                    if (!TextUtils.isEmpty(s) && !TextUtils.isEmpty(datum.getPackageId()) && s.equals(datum.getPackageId())) {
                                        contentBeanList3.add(new ComparisonDetailContentBean.ContentBean(-1, datum.getSchemeRatio2() + "%"));
                                    }
                                }
                            }
                            comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                                    "用户向下分成系数", contentBeanList3));
                        }

                        List<String> list = new ArrayList<>();

                        int index = 0;
                        for (List<PackageInfoMonthBean.Bean> beanList : monthDataMap.values()) {
                            if (beanList.size() > 0) {
                                list.add(beanList.get(monthSelectIndexList.get(index)).getMainSchemeId());
                            }
                            index++;
                        }

                        for (PackageBean packageBean : selectPackageList) {
                            for (PackageComparisonDetailBean.Bean datum : response.getData()) {
                                if (packageBean.getCombId().equals(datum.getCombId())) {
                                    List<Boolean> booleans = new ArrayList<>();
                                    booleans.add((datum.getMainType().equals("01") || datum.getMainType().equals("02")));//分时分电量01，分时不分电量02，不分时分电量03，不分时不分电量04
                                    booleans.add((datum.getFloType().equals("01") || datum.getFloType().equals("02")));//分时分电量01，分时不分电量02，不分时分电量03，不分时不分电量04
                                    isShowPriceCurve.add(booleans);
                                }
                            }
                        }
                        getPackageComparisonPriceDetailMain(list, isLoading, response.getData());


                    }

                });


    }

    //基准套餐
    private void getPackageComparisonPriceDetailMain(List<String> list, boolean isLoading,
                                                     List<PackageComparisonDetailBean.Bean> beanList) {
        Map<String, Object> params = new HashMap<>();
        params.put("schemeIds", list);
        params.put("_t", System.currentTimeMillis());
        //价格曲线
        HttpRequestUtils.getInstance().request(params, HttpInterConst.PACKAGE_COMPARISON_SCHEME_DETAIL,
                new MvpNetCallback<PackageComparisonSchemeDetailBean>(getView(), isLoading) {
                    @Override
                    public void onError(Call call, Exception e, int id) {
                        super.onError(call, e, id);
                        // 失败回调 判断界面是否销毁
                        getView().queryFailed();
                    }

                    @Override
                    public void onResponse(PackageComparisonSchemeDetailBean packageComparisonSchemeDetailBean, int id) {
                        super.onResponse(packageComparisonSchemeDetailBean, id);
                        //补充内容
                        HttpRequestUtils.getInstance().request(params, HttpInterConst.PACKAGE_COMPARISON_PRICE_DETAIL,
                                new MvpNetCallback<PackageComparisonPriceDetailBean>(getView(), isLoading) {
                                    @Override
                                    public void onError(Call call, Exception e, int id) {
                                        super.onError(call, e, id);
                                        // 失败回调 判断界面是否销毁
                                        getView().queryFailed();
                                    }

                                    @Override
                                    public void onResponse(PackageComparisonPriceDetailBean response, int id) {
                                        super.onResponse(response, id);


                                        List<List<PackageComparisonPriceDetailBean.Bean>> data = response.getData();

                                        if (null != beanList && beanList.size() == data.size()) {
                                            comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.TITLE,
                                                    R.mipmap.ic_single_package, "基准套餐/基础价格套餐参数"));
                                            List<ComparisonDetailContentBean.ContentBean> contentBeanList1 = new ArrayList<>();
                                            List<String> idStrList = new ArrayList<>();
                                            for (String s : monthDataMap.keySet()) {
                                                idStrList.add(s);
                                            }
                                            for (int i = 0; i < idStrList.size(); i++) {//找到对应的数据  传递顺序是123 返回有可能213或者其他需要重新遍历找到对应的
                                                String schemeId = idStrList.get(i);
                                                ComparisonDetailContentBean.ContentBean contentBean = new ComparisonDetailContentBean.ContentBean(-1, "--");
                                                for (PackageComparisonDetailBean.Bean bean : beanList) {
                                                    if (!TextUtils.isEmpty(bean.getCombId()) && !TextUtils.isEmpty(schemeId) && schemeId.equals(bean.getCombId()) && !TextUtils.isEmpty(bean.getMainType())) {
                                                        contentBean = new ComparisonDetailContentBean.ContentBean(1, getTime(bean.getMainType()));
                                                    }
                                                }
                                                contentBeanList1.add(contentBean);

                                            }
                                            comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                                                    "是否分时段", contentBeanList1));


                                            List<ComparisonDetailContentBean.ContentBean> contentBeanList2 = new ArrayList<>();


                                            for (int i = 0; i < idStrList.size(); i++) {//找到对应的数据  传递顺序是123 返回有可能213或者其他需要重新遍历找到对应的
                                                String schemeId = idStrList.get(i);
                                                ComparisonDetailContentBean.ContentBean contentBean = new ComparisonDetailContentBean.ContentBean(-1, "--");
                                                for (PackageComparisonDetailBean.Bean bean : beanList) {
                                                    if (!TextUtils.isEmpty(bean.getCombId()) && !TextUtils.isEmpty(schemeId) && schemeId.equals(bean.getCombId()) && !TextUtils.isEmpty(bean.getMainType())) {
                                                        contentBean = new ComparisonDetailContentBean.ContentBean(1, getElectricity(bean.getMainType()));
                                                    }
                                                }
                                                contentBeanList2.add(contentBean);
                                            }

                                            comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                                                    "是否约定电量", contentBeanList2));


                                            List<ComparisonDetailContentBean.ContentBean> contentBeanList3 = new ArrayList<>();
                                            //找到对应的数据  传递顺序是123 返回有可能213或者其他需要重新遍历找到对应的
                                            for (int i = 0; i < list.size(); i++) {
                                                List<List<PackageComparisonSchemeDetailBean.Bean>> data1 =
                                                        packageComparisonSchemeDetailBean.getData();//价格曲线数据
                                                String schemeId = list.get(i);
                                                if (!TextUtils.isEmpty(schemeId)) {
                                                    for (int i1 = 0; i1 < data1.size(); i1++) {
                                                        List<PackageComparisonSchemeDetailBean.Bean> beanList = data1.get(i1);
                                                        if (null != beanList && beanList.size() > 0 && schemeId.equals(beanList.get(0).getSchemeId()))//有数据
                                                            contentBeanList3.add(new ComparisonDetailContentBean.ContentBean(-1, beanList.get(0).getPlRange()));
                                                    }

                                                } else {
                                                    contentBeanList3.add(new ComparisonDetailContentBean.ContentBean(-1, "--"));
                                                }
                                            }


                                            comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                                                    "电量允许免偏差范围(正)", contentBeanList3));


                                            List<ComparisonDetailContentBean.ContentBean> contentBeanList31 = new ArrayList<>();
                                            //找到对应的数据  传递顺序是123 返回有可能213或者其他需要重新遍历找到对应的
                                            for (int i = 0; i < list.size(); i++) {
                                                List<List<PackageComparisonSchemeDetailBean.Bean>> data1 =
                                                        packageComparisonSchemeDetailBean.getData();//价格曲线数据
                                                String schemeId = list.get(i);
                                                if (!TextUtils.isEmpty(schemeId)) {
                                                    for (int i1 = 0; i1 < data1.size(); i1++) {
                                                        List<PackageComparisonSchemeDetailBean.Bean> beanList = data1.get(i1);
                                                        if (null != beanList && beanList.size() > 0 && schemeId.equals(beanList.get(0).getSchemeId()))//有数据
                                                            contentBeanList31.add(new ComparisonDetailContentBean.ContentBean(-1, beanList.get(0).getNdRange()));
                                                    }

                                                } else {
                                                    contentBeanList31.add(new ComparisonDetailContentBean.ContentBean(-1, "--"));
                                                }
                                            }

                                            comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                                                    "电量允许免偏差范围(负)", contentBeanList31));

                                            List<ComparisonDetailContentBean.ContentBean> contentBeanList41 = new ArrayList<>();
                                            List<ComparisonDetailContentBean.ContentBean> contentBeanList42 = new ArrayList<>();
                                            List<ComparisonDetailContentBean.ContentBean> contentBeanList43 = new ArrayList<>();

                                            for (int i = 0; i < list.size(); i++) {//找到对应的数据  传递顺序是123 返回有可能213或者其他需要重新遍历找到对应的

                                                List<List<PackageComparisonSchemeDetailBean.Bean>> data1 =
                                                        packageComparisonSchemeDetailBean.getData();//价格曲线数据
                                                String schemeId = list.get(i);
                                                if (!TextUtils.isEmpty(schemeId)) {
                                                    String text1 = "约定价格";

                                                    List<String> priceCurveList = new ArrayList<>();
                                                    for (int i1 = 0; i1 < data1.size(); i1++) {
                                                        List<PackageComparisonSchemeDetailBean.Bean> beanList = data1.get(i1);
                                                        if (null != beanList && beanList.size() > 0)//有数据
                                                            if (schemeId.equals(beanList.get(0).getSchemeId())) {
                                                                text1 = beanList.size() == 1 && beanList.get(0).getEItemName().equals("约定价格") ? beanList.get(0).getEItemName() + ":" + beanList.get(0).getEItemValue() + "元/度" : beanList.get(0).getEItemName();//约定电量 / 计量电量电价名称 text1
                                                                for (PackageComparisonSchemeDetailBean.Bean bean : beanList) {
                                                                    if (bean.getEItemId().equals("D111") && isShowPriceCurve.get(i1).get(0))//添加价格曲线
                                                                        priceCurveList.add(bean.getEItemValue());
                                                                }

                                                            }
                                                    }

                                                    String text2 = "--";
                                                    String text3 = "--";
                                                    for (List<PackageComparisonPriceDetailBean.Bean> datum : data) {//补充内容数据
                                                        if (null != datum && datum.size() > 0) {//有数据

                                                            for (int i1 = 0; i1 < datum.size(); i1++) {
                                                                PackageComparisonPriceDetailBean.Bean bean = datum.get(i1);
                                                                if (bean.getEnergyType().equals("01") && schemeId.equals(bean.getSchemeId())) {
                                                                    if (bean.getConfigId().equals("E111")) {
                                                                        text2 = bean.getConfigValue();
                                                                    } else {
                                                                        text3 = bean.getConfigValue();
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }

                                                    contentBeanList41.add(new ComparisonDetailContentBean.ContentBean(2,
                                                            new ComparisonDetailContentBean.MealBean(false,
                                                                    true, text1.equals("--:--元/度") ? "--" : text1, priceCurveList)));
                                                    contentBeanList42.add(new ComparisonDetailContentBean.
                                                            ContentBean(-1, text2));
                                                    contentBeanList43.add(new ComparisonDetailContentBean.
                                                            ContentBean(-1, text3));
                                                } else {
                                                    contentBeanList41.add(new ComparisonDetailContentBean.
                                                            ContentBean(-1, "--"));
                                                    contentBeanList42.add(new ComparisonDetailContentBean.
                                                            ContentBean(-1, "--"));
                                                    contentBeanList43.add(new ComparisonDetailContentBean.
                                                            ContentBean(-1, "--"));
                                                }

                                            }


                                            comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                                                    "约定电量/用电量电价参数 - 价格", contentBeanList41));
                                            comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                                                    "约定电量/用电量电价参数 - 固定价差", contentBeanList42));
                                            comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                                                    "约定电量/用电量电价参数 - 浮动价差", contentBeanList43));


                                            List<ComparisonDetailContentBean.ContentBean> contentBeanList51 = new ArrayList<>();
                                            List<ComparisonDetailContentBean.ContentBean> contentBeanList52 = new ArrayList<>();
                                            List<ComparisonDetailContentBean.ContentBean> contentBeanList53 = new ArrayList<>();


                                            for (int i = 0; i < list.size(); i++) {//找到对应的数据  传递顺序是123 返回有可能213或者其他需要重新遍历找到对应的

                                                List<List<PackageComparisonSchemeDetailBean.Bean>> data1 =
                                                        packageComparisonSchemeDetailBean.getData();//价格曲线数据
                                                String schemeId = list.get(i);
                                                if (!TextUtils.isEmpty(schemeId)) {
                                                    String text1 = "约定价格";

                                                    List<String> priceCurveList = new ArrayList<>();
                                                    for (int i1 = 0; i1 < data1.size(); i1++) {
                                                        List<PackageComparisonSchemeDetailBean.Bean> beanList = data1.get(i1);
                                                        if (null != beanList && beanList.size() > 0)//有数据
                                                            if (schemeId.equals(beanList.get(0).getSchemeId())) {
                                                                text1 = beanList.size() == 1 && beanList.get(0).getPlItemName().equals("约定价格") ? beanList.get(0).getPlItemName() + ":" + beanList.get(0).getPlItemValue() + "元/度" : beanList.get(0).getPlItemName();//正偏差电量电价名称 text1
                                                                for (PackageComparisonSchemeDetailBean.Bean bean : beanList) {
                                                                    if (bean.getPlItemId().equals("D111") && isShowPriceCurve.get(i1).get(0))//添加价格曲线
                                                                        priceCurveList.add(bean.getPlItemValue());
                                                                }


                                                            }
                                                    }


                                                    String text2 = "";
                                                    String text3 = "";
                                                    for (List<PackageComparisonPriceDetailBean.Bean> datum : data) {//补充内容数据
                                                        if (null != datum && datum.size() > 0) {//有数据
                                                            for (int i1 = 0; i1 < datum.size(); i1++) {
                                                                PackageComparisonPriceDetailBean.Bean bean = datum.get(i1);
                                                                if (bean.getEnergyType().equals("02") && schemeId.equals(bean.getSchemeId())) {
                                                                    if (bean.getConfigId().equals("E111")) {
                                                                        text2 = bean.getConfigValue();
                                                                    } else {
                                                                        text3 = bean.getConfigValue();
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }

                                                    contentBeanList51.add(new ComparisonDetailContentBean.ContentBean(2,
                                                            new ComparisonDetailContentBean.MealBean(false,
                                                                    true, text1.equals("--:--元/度") ? "--" : text1, priceCurveList)));
                                                    contentBeanList52.add(new ComparisonDetailContentBean.
                                                            ContentBean(-1, text2));
                                                    contentBeanList53.add(new ComparisonDetailContentBean.
                                                            ContentBean(-1, text3));
                                                } else {
                                                    contentBeanList51.add(new ComparisonDetailContentBean.
                                                            ContentBean(-1, "--"));
                                                    contentBeanList52.add(new ComparisonDetailContentBean.
                                                            ContentBean(-1, "--"));
                                                    contentBeanList53.add(new ComparisonDetailContentBean.
                                                            ContentBean(-1, "--"));
                                                }


                                            }
                                            comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                                                    "正偏差电量电价参数 - 价格", contentBeanList51));
                                            comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                                                    "正偏差电量电价参数 - 固定价差", contentBeanList52));
                                            comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                                                    "正偏差电量电价参数 - 浮动价差", contentBeanList53));


                                            List<ComparisonDetailContentBean.ContentBean> contentBeanList61 = new ArrayList<>();
                                            List<ComparisonDetailContentBean.ContentBean> contentBeanList62 = new ArrayList<>();
                                            List<ComparisonDetailContentBean.ContentBean> contentBeanList63 = new ArrayList<>();

                                            for (int i = 0; i < list.size(); i++) {//找到对应的数据  传递顺序是123 返回有可能213或者其他需要重新遍历找到对应的


                                                List<List<PackageComparisonSchemeDetailBean.Bean>> data1 =
                                                        packageComparisonSchemeDetailBean.getData();//价格曲线数据
                                                String schemeId = list.get(i);
                                                if (!TextUtils.isEmpty(schemeId)) {
                                                    String text1 = "约定价格";
                                                    List<String> priceCurveList = new ArrayList<>();
                                                    for (int i1 = 0; i1 < data1.size(); i1++) {
                                                        List<PackageComparisonSchemeDetailBean.Bean> beanList = data1.get(i1);
                                                        if (null != beanList && beanList.size() > 0)//有数据
                                                            if (schemeId.equals(beanList.get(0).getSchemeId())) {
                                                                text1 = beanList.size() == 1 && beanList.get(0).getNdItemName().equals("约定价格") ? beanList.get(0).getNdItemName() + ":" + beanList.get(0).getNdItemValue() + "元/度" : beanList.get(0).getNdItemName();//负偏差电量电价 text1
                                                                for (PackageComparisonSchemeDetailBean.Bean bean : beanList) {
                                                                    if (bean.getNdItemId().equals("D111") && isShowPriceCurve.get(i1).get(0))//添加价格曲线
                                                                        priceCurveList.add(bean.getNdItemValue());

                                                                }

                                                            }
                                                    }

                                                    String text2 = "";
                                                    String text3 = "";
                                                    for (List<PackageComparisonPriceDetailBean.Bean> datum : data) {//补充内容数据
                                                        if (null != datum && datum.size() > 0) {//有数据
                                                            for (int i1 = 0; i1 < datum.size(); i1++) {
                                                                PackageComparisonPriceDetailBean.Bean bean = datum.get(i1);
                                                                if (bean.getEnergyType().equals("03") && schemeId.equals(bean.getSchemeId())) {
                                                                    if (bean.getConfigId().equals("E111")) {
                                                                        text2 = bean.getConfigValue();
                                                                    } else {
                                                                        text3 = bean.getConfigValue();
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }

                                                    contentBeanList61.add(new ComparisonDetailContentBean.ContentBean(2,
                                                            new ComparisonDetailContentBean.MealBean(false, true, text1.equals("--:--元/度") ? "--" : text1,
                                                                    priceCurveList)));
                                                    contentBeanList62.add(new ComparisonDetailContentBean.
                                                            ContentBean(-1, text2));
                                                    contentBeanList63.add(new ComparisonDetailContentBean.
                                                            ContentBean(-1, text3));

                                                } else {
                                                    contentBeanList61.add(new ComparisonDetailContentBean.
                                                            ContentBean(-1, "--"));
                                                    contentBeanList62.add(new ComparisonDetailContentBean.
                                                            ContentBean(-1, "--"));
                                                    contentBeanList63.add(new ComparisonDetailContentBean.
                                                            ContentBean(-1, "--"));
                                                }
                                            }

                                            comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                                                    "负偏差电量电价参数 - 价格", contentBeanList61));
                                            comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                                                    "负偏差电量电价参数 - 固定价差", contentBeanList62));
                                            comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                                                    "负偏差电量电价参数 - 浮动价差", contentBeanList63));

                                            List<String> list = new ArrayList<>();
                                            int index = 0;
                                            for (List<PackageInfoMonthBean.Bean> beanList : monthDataMap.values()) {
                                                if (beanList.size() > 0) {
                                                    list.add(beanList.get(monthSelectIndexList.get(index)).getFloSchemeId());
                                                }
                                                index++;
                                            }
                                            getPackageComparisonPriceDetailFlo(list, isLoading, beanList);

                                        }


                                    }


                                });


                    }
                });


    }


    //浮动套餐
    private void getPackageComparisonPriceDetailFlo(List<String> list, boolean isLoading,
                                                    List<PackageComparisonDetailBean.Bean> beanList) {
        Map<String, Object> params = new HashMap<>();
        params.put("schemeIds", list);
        params.put("_t", System.currentTimeMillis());
        //价格曲线
        HttpRequestUtils.getInstance().request(params, HttpInterConst.PACKAGE_COMPARISON_SCHEME_DETAIL,
                new MvpNetCallback<PackageComparisonSchemeDetailBean>(getView(), isLoading) {
                    @Override
                    public void onError(Call call, Exception e, int id) {
                        super.onError(call, e, id);
                        // 失败回调 判断界面是否销毁
                        getView().queryFailed();
                    }

                    @Override
                    public void onResponse(PackageComparisonSchemeDetailBean packageComparisonSchemeDetailBean, int id) {
                        super.onResponse(packageComparisonSchemeDetailBean, id);
                        //补充内容
                        HttpRequestUtils.getInstance().request(params, HttpInterConst.PACKAGE_COMPARISON_PRICE_DETAIL,
                                new MvpNetCallback<PackageComparisonPriceDetailBean>(getView(), isLoading) {
                                    @Override
                                    public void onError(Call call, Exception e, int id) {
                                        super.onError(call, e, id);
                                        // 失败回调 判断界面是否销毁
                                        getView().queryFailed();
                                    }

                                    @Override
                                    public void onResponse(PackageComparisonPriceDetailBean response, int id) {
                                        super.onResponse(response, id);


                                        List<List<PackageComparisonPriceDetailBean.Bean>> data = response.getData();

                                        if (null != beanList && beanList.size() == data.size()) {
                                            comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.TITLE,
                                                    R.mipmap.ic_float, "浮动套餐参数"));

                                            List<String> idStrList = new ArrayList<>();
                                            for (String s : monthDataMap.keySet()) {
                                                idStrList.add(s);
                                            }

                                            List<ComparisonDetailContentBean.ContentBean> contentBeanList1 = new ArrayList<>();


                                            for (int i = 0; i < idStrList.size(); i++) {//找到对应的数据  传递顺序是123 返回有可能213或者其他需要重新遍历找到对应的
                                                String schemeId = idStrList.get(i);
                                                ComparisonDetailContentBean.ContentBean contentBean = new ComparisonDetailContentBean.ContentBean(-1, "--");
                                                for (PackageComparisonDetailBean.Bean bean : beanList) {
                                                    if (!TextUtils.isEmpty(bean.getCombId()) && !TextUtils.isEmpty(schemeId) && schemeId.equals(bean.getCombId()) && !TextUtils.isEmpty(bean.getFloType())) {
                                                        contentBean = new ComparisonDetailContentBean.ContentBean(1, getTime(bean.getFloType()));
                                                    }
                                                }
                                                contentBeanList1.add(contentBean);
                                            }
                                            comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                                                    "是否分时段", contentBeanList1));


                                            List<ComparisonDetailContentBean.ContentBean> contentBeanList2 = new ArrayList<>();


                                            for (int i = 0; i < idStrList.size(); i++) {//找到对应的数据  传递顺序是123 返回有可能213或者其他需要重新遍历找到对应的
                                                String schemeId = idStrList.get(i);
                                                ComparisonDetailContentBean.ContentBean contentBean = new ComparisonDetailContentBean.ContentBean(-1, "--");
                                                for (PackageComparisonDetailBean.Bean bean : beanList) {
                                                    if (!TextUtils.isEmpty(bean.getCombId()) && !TextUtils.isEmpty(schemeId) && schemeId.equals(bean.getCombId()) && !TextUtils.isEmpty(bean.getFloType())) {
                                                        contentBean = new ComparisonDetailContentBean.ContentBean(1, getElectricity(bean.getFloType()));
                                                    }
                                                }
                                                contentBeanList2.add(contentBean);
                                            }

                                            comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                                                    "是否约定电量", contentBeanList2));


                                            List<ComparisonDetailContentBean.ContentBean> contentBeanList3 = new ArrayList<>();
                                            //找到对应的数据  传递顺序是123 返回有可能213或者其他需要重新遍历找到对应的
                                            for (int i = 0; i < list.size(); i++) {
                                                List<List<PackageComparisonSchemeDetailBean.Bean>> data1 =
                                                        packageComparisonSchemeDetailBean.getData();//价格曲线数据
                                                String schemeId = list.get(i);
                                                if (!TextUtils.isEmpty(schemeId)) {
                                                    for (int i1 = 0; i1 < data1.size(); i1++) {
                                                        List<PackageComparisonSchemeDetailBean.Bean> beanList = data1.get(i1);
                                                        if (null != beanList && beanList.size() > 0 && schemeId.equals(beanList.get(0).getSchemeId()))//有数据
                                                            contentBeanList3.add(new ComparisonDetailContentBean.ContentBean(-1, beanList.get(0).getPlRange()));
                                                    }

                                                } else {
                                                    contentBeanList3.add(new ComparisonDetailContentBean.ContentBean(-1, "--"));
                                                }
                                            }


                                            comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                                                    "电量允许免偏差范围(正)", contentBeanList3));


                                            List<ComparisonDetailContentBean.ContentBean> contentBeanList31 = new ArrayList<>();
                                            //找到对应的数据  传递顺序是123 返回有可能213或者其他需要重新遍历找到对应的
                                            for (int i = 0; i < list.size(); i++) {
                                                List<List<PackageComparisonSchemeDetailBean.Bean>> data1 =
                                                        packageComparisonSchemeDetailBean.getData();//价格曲线数据
                                                String schemeId = list.get(i);
                                                if (!TextUtils.isEmpty(schemeId)) {
                                                    for (int i1 = 0; i1 < data1.size(); i1++) {
                                                        List<PackageComparisonSchemeDetailBean.Bean> beanList = data1.get(i1);
                                                        if (null != beanList && beanList.size() > 0 && schemeId.equals(beanList.get(0).getSchemeId()))//有数据
                                                            contentBeanList31.add(new ComparisonDetailContentBean.ContentBean(-1, beanList.get(0).getNdRange()));
                                                    }

                                                } else {
                                                    contentBeanList31.add(new ComparisonDetailContentBean.ContentBean(-1, "--"));
                                                }
                                            }

                                            comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                                                    "电量允许免偏差范围(负)", contentBeanList31));


                                            List<ComparisonDetailContentBean.ContentBean> contentBeanList41 = new ArrayList<>();
                                            List<ComparisonDetailContentBean.ContentBean> contentBeanList42 = new ArrayList<>();
                                            List<ComparisonDetailContentBean.ContentBean> contentBeanList43 = new ArrayList<>();

                                            for (int i = 0; i < list.size(); i++) {//找到对应的数据  传递顺序是123 返回有可能213或者其他需要重新遍历找到对应的

                                                List<List<PackageComparisonSchemeDetailBean.Bean>> data1 =
                                                        packageComparisonSchemeDetailBean.getData();//价格曲线数据
                                                String schemeId = list.get(i);
                                                if (!TextUtils.isEmpty(schemeId)) {
                                                    String text1 = "约定价格";
                                                    List<String> priceCurveList = new ArrayList<>();
                                                    for (int i1 = 0; i1 < data1.size(); i1++) {
                                                        List<PackageComparisonSchemeDetailBean.Bean> beanList = data1.get(i1);
                                                        if (null != beanList && beanList.size() > 0)//有数据
                                                            if (schemeId.equals(beanList.get(0).getSchemeId())) {
                                                                text1 = beanList.size() == 1 && beanList.get(0).getEItemName().equals("约定价格") ? beanList.get(0).getEItemName() + ":" + beanList.get(0).getEItemValue() + "元/度" : beanList.get(0).getEItemName();//约定电量 / 计量电量电价名称 text1
                                                                for (PackageComparisonSchemeDetailBean.Bean bean : beanList) {
                                                                    if (bean.getEItemId().equals("D111") && isShowPriceCurve.get(i1).get(1))//添加价格曲线
                                                                        priceCurveList.add(bean.getEItemValue());
                                                                }


                                                            }
                                                    }


                                                    String text2 = "";
                                                    String text3 = "";
                                                    for (List<PackageComparisonPriceDetailBean.Bean> datum : data) {//补充内容数据
                                                        if (null != datum && datum.size() > 0) {//有数据
                                                            for (int i1 = 0; i1 < datum.size(); i1++) {
                                                                PackageComparisonPriceDetailBean.Bean bean = datum.get(i1);
                                                                if (bean.getEnergyType().equals("01") && schemeId.equals(bean.getSchemeId())) {
                                                                    if (bean.getConfigId().equals("E111")) {
                                                                        text2 = bean.getConfigValue();
                                                                    } else {
                                                                        text3 = bean.getConfigValue();
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }

                                                    contentBeanList41.add(new ComparisonDetailContentBean.ContentBean(2,
                                                            new ComparisonDetailContentBean.MealBean(false, true, text1.equals("--:--元/度") ? "--" : text1,
                                                                    priceCurveList)));
                                                    contentBeanList42.add(new ComparisonDetailContentBean.
                                                            ContentBean(-1, text2));
                                                    contentBeanList43.add(new ComparisonDetailContentBean.
                                                            ContentBean(-1, text3));
                                                } else {
                                                    contentBeanList41.add(new ComparisonDetailContentBean.
                                                            ContentBean(-1, "--"));
                                                    contentBeanList42.add(new ComparisonDetailContentBean.
                                                            ContentBean(-1, "--"));
                                                    contentBeanList43.add(new ComparisonDetailContentBean.
                                                            ContentBean(-1, "--"));
                                                }

                                            }


                                            comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                                                    "约定电量/用电量电价参数 - 价格", contentBeanList41));
                                            comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                                                    "约定电量/用电量电价参数 - 固定价差", contentBeanList42));
                                            comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                                                    "约定电量/用电量电价参数 - 浮动价差", contentBeanList43));


                                            List<ComparisonDetailContentBean.ContentBean> contentBeanList51 = new ArrayList<>();
                                            List<ComparisonDetailContentBean.ContentBean> contentBeanList52 = new ArrayList<>();
                                            List<ComparisonDetailContentBean.ContentBean> contentBeanList53 = new ArrayList<>();


                                            for (int i = 0; i < list.size(); i++) {//找到对应的数据  传递顺序是123 返回有可能213或者其他需要重新遍历找到对应的

                                                List<List<PackageComparisonSchemeDetailBean.Bean>> data1 =
                                                        packageComparisonSchemeDetailBean.getData();//价格曲线数据
                                                String schemeId = list.get(i);
                                                if (!TextUtils.isEmpty(schemeId)) {
                                                    String text1 = "约定价格";
                                                    List<String> priceCurveList = new ArrayList<>();
                                                    for (int i1 = 0; i1 < data1.size(); i1++) {
                                                        List<PackageComparisonSchemeDetailBean.Bean> beanList = data1.get(i1);
                                                        if (null != beanList && beanList.size() > 0)//有数据
                                                            if (schemeId.equals(beanList.get(0).getSchemeId())) {
                                                                text1 = beanList.size() == 1 && beanList.get(0).getPlItemName().equals("约定价格") ? beanList.get(0).getPlItemName() + ":" + beanList.get(0).getPlItemValue() + "元/度" : beanList.get(0).getPlItemName();//正偏差电量电价名称 text1
                                                                for (PackageComparisonSchemeDetailBean.Bean bean : beanList) {
                                                                    if (bean.getPlItemId().equals("D111") && isShowPriceCurve.get(i1).get(1))//添加价格曲线
                                                                        priceCurveList.add(bean.getPlItemValue());
                                                                }

                                                            }
                                                    }


                                                    String text2 = "";
                                                    String text3 = "";
                                                    for (List<PackageComparisonPriceDetailBean.Bean> datum : data) {//补充内容数据
                                                        if (null != datum && datum.size() > 0) {//有数据
                                                            for (int i1 = 0; i1 < datum.size(); i1++) {
                                                                PackageComparisonPriceDetailBean.Bean bean = datum.get(i1);
                                                                if (bean.getEnergyType().equals("02") && schemeId.equals(bean.getSchemeId())) {
                                                                    if (bean.getConfigId().equals("E111")) {
                                                                        text2 = bean.getConfigValue();
                                                                    } else {
                                                                        text3 = bean.getConfigValue();
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }

                                                    contentBeanList51.add(new ComparisonDetailContentBean.ContentBean(2,
                                                            new ComparisonDetailContentBean.MealBean(false, true, text1.equals("--:--元/度") ? "--" : text1,
                                                                    priceCurveList)));
                                                    contentBeanList52.add(new ComparisonDetailContentBean.
                                                            ContentBean(-1, text2));
                                                    contentBeanList53.add(new ComparisonDetailContentBean.
                                                            ContentBean(-1, text3));
                                                } else {
                                                    contentBeanList51.add(new ComparisonDetailContentBean.
                                                            ContentBean(-1, "--"));
                                                    contentBeanList52.add(new ComparisonDetailContentBean.
                                                            ContentBean(-1, "--"));
                                                    contentBeanList53.add(new ComparisonDetailContentBean.
                                                            ContentBean(-1, "--"));
                                                }


                                            }
                                            comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                                                    "正偏差电量电价参数 - 价格", contentBeanList51));
                                            comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                                                    "正偏差电量电价参数 - 固定价差", contentBeanList52));
                                            comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                                                    "正偏差电量电价参数 - 浮动价差", contentBeanList53));



                                            List<ComparisonDetailContentBean.ContentBean> contentBeanList61 = new ArrayList<>();
                                            List<ComparisonDetailContentBean.ContentBean> contentBeanList62 = new ArrayList<>();
                                            List<ComparisonDetailContentBean.ContentBean> contentBeanList63 = new ArrayList<>();

                                            for (int i = 0; i < list.size(); i++) {//找到对应的数据  传递顺序是123 返回有可能213或者其他需要重新遍历找到对应的


                                                List<List<PackageComparisonSchemeDetailBean.Bean>> data1 =
                                                        packageComparisonSchemeDetailBean.getData();//价格曲线数据
                                                String schemeId = list.get(i);
                                                if (!TextUtils.isEmpty(schemeId)) {
                                                    String text1 = "约定价格";

                                                    List<String> priceCurveList = new ArrayList<>();
                                                    for (int i1 = 0; i1 < data1.size(); i1++) {
                                                        List<PackageComparisonSchemeDetailBean.Bean> beanList = data1.get(i1);
                                                        if (null != beanList && beanList.size() > 0)//有数据
                                                            if (schemeId.equals(beanList.get(0).getSchemeId())) {
                                                                text1 = beanList.size() == 1 && beanList.get(0).getNdItemName().equals("约定价格") ?
                                                                        beanList.get(0).getNdItemName() + ":" + beanList.get(0).getNdItemValue() + "元/度" : beanList.get(0).getNdItemName();//正偏差电量电价名称 text1
                                                                for (PackageComparisonSchemeDetailBean.Bean bean : beanList) {
                                                                    if (bean.getNdItemId().equals("D111") && isShowPriceCurve.get(i1).get(1))//添加价格曲线
                                                                        priceCurveList.add(bean.getNdItemValue());
                                                                }

                                                            }
                                                    }


                                                    String text2 = "";
                                                    String text3 = "";
                                                    for (List<PackageComparisonPriceDetailBean.Bean> datum : data) {//补充内容数据
                                                        if (null != datum && datum.size() > 0) {//有数据
                                                            for (int i1 = 0; i1 < datum.size(); i1++) {
                                                                PackageComparisonPriceDetailBean.Bean bean = datum.get(i1);
                                                                if (bean.getEnergyType().equals("03") && schemeId.equals(bean.getSchemeId())) {
                                                                    if (bean.getConfigId().equals("E111")) {
                                                                        text2 = bean.getConfigValue();
                                                                    } else {
                                                                        text3 = bean.getConfigValue();
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }

                                                    contentBeanList61.add(new ComparisonDetailContentBean.ContentBean(2,
                                                            new ComparisonDetailContentBean.MealBean(false, true, text1.equals("--:--元/度") ? "--" : text1,
                                                                    priceCurveList)));
                                                    contentBeanList61.add(new ComparisonDetailContentBean.ContentBean(2,
                                                            new ComparisonDetailContentBean.MealBean(false, true, text1.equals("--:--元/度") ? "--" : text1,
                                                                    priceCurveList)));
                                                    contentBeanList62.add(new ComparisonDetailContentBean.
                                                            ContentBean(-1, text2));
                                                    contentBeanList63.add(new ComparisonDetailContentBean.
                                                            ContentBean(-1, text3));

                                                } else {
                                                    contentBeanList61.add(new ComparisonDetailContentBean.
                                                            ContentBean(-1, "--"));
                                                    contentBeanList62.add(new ComparisonDetailContentBean.
                                                            ContentBean(-1, "--"));
                                                    contentBeanList63.add(new ComparisonDetailContentBean.
                                                            ContentBean(-1, "--"));
                                                }
                                            }

                                            comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                                                    "负偏差电量电价参数 - 价格", contentBeanList61));
                                            comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                                                    "负偏差电量电价参数 - 固定价差", contentBeanList62));
                                            comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                                                    "负偏差电量电价参数 - 浮动价差", contentBeanList63));



                                        }
                                        getView().
                                                querySuccess(comparisonDetailBackBean,
                                                        new ComparisonDetailDataBean(comparisonDetailContentBeans, comparisonDetailTopBeans));
                                    }


                                });


                    }
                });


    }


    //初始化基本信息数据
    private void initData1(PackageComparisonBean response) {

        List<PackageComparisonBean.Bean> data = response.getData();

        comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.TITLE,
                R.mipmap.ic_price, "预估价格", "设置用电比例获取价格"));

        List<ComparisonDetailContentBean.ContentBean> contentBeanList10 = new ArrayList<>();
        for (PackageComparisonBean.Bean datum : data) {
            contentBeanList10.add(new ComparisonDetailContentBean.ContentBean(-1, "--", datum.getPackageId()));
        }
        comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                "商品", contentBeanList10));

        List<ComparisonDetailContentBean.ContentBean> contentBeanList11 = new ArrayList<>();
        for (PackageComparisonBean.Bean datum : data) {
            contentBeanList11.add(new ComparisonDetailContentBean.ContentBean(-1, "--", datum.getPackageId()));
        }
        comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                "基础价格套餐", contentBeanList11));

        List<ComparisonDetailContentBean.ContentBean> contentBeanList12 = new ArrayList<>();
        for (PackageComparisonBean.Bean datum : data) {
            contentBeanList12.add(new ComparisonDetailContentBean.ContentBean(-1, "--", datum.getPackageId()));
        }
        comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                "浮动套餐", contentBeanList12));


        comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.TITLE,
                R.mipmap.ic_comparison_info, "基本信息"));


        List<ComparisonDetailContentBean.ContentBean> contentBeanList1 = new ArrayList<>();
        for (PackageComparisonBean.Bean datum : data) {
            contentBeanList1.add(new ComparisonDetailContentBean.ContentBean(-1, datum.getMembersSdName()));
        }
        comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                "所属店铺", contentBeanList1));

        List<ComparisonDetailContentBean.ContentBean> contentBeanList2 = new ArrayList<>();
        for (PackageComparisonBean.Bean datum : data) {
            contentBeanList2.add(new ComparisonDetailContentBean.ContentBean(-1, datum.getEffectiveDate()
                    + "~" + datum.getInvalidDate()));
        }
        comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                "标的周期", contentBeanList2));

        List<ComparisonDetailContentBean.ContentBean> contentBeanList35 = new ArrayList<>();
        for (PackageComparisonBean.Bean datum : data) {
            contentBeanList35.add(new ComparisonDetailContentBean.ContentBean(-1, datum.getConstrMin()));
        }
        comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                "最小购买周期", contentBeanList35));

        List<ComparisonDetailContentBean.ContentBean> contentBeanList36 = new ArrayList<>();
        for (PackageComparisonBean.Bean datum : data) {
            contentBeanList36.add(new ComparisonDetailContentBean.ContentBean(-1, datum.getConstrMax()));
        }
        comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                "最大购买周期", contentBeanList36));

//        List<ComparisonDetailContentBean.ContentBean> contentBeanList31 = new ArrayList<>();
//        for (PackageComparisonBean.Bean datum : data) {
//            contentBeanList31.add(new ComparisonDetailContentBean.ContentBean(-1, datum.getConstrCla()));
//        }
//        comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
//                "解约金", contentBeanList31));

        List<ComparisonDetailContentBean.ContentBean> contentBeanList32 = new ArrayList<>();
        for (PackageComparisonBean.Bean datum : data) {
            contentBeanList32.add(new ComparisonDetailContentBean.ContentBean(-1, datum.getVoltageLevel()));
        }
        comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                "电压等级要求", contentBeanList32));


        List<ComparisonDetailContentBean.ContentBean> contentBeanList33 = new ArrayList<>();
        for (PackageComparisonBean.Bean datum : data) {
            contentBeanList33.add(new ComparisonDetailContentBean.ContentBean(-1, datum.getUserEnergy()));
        }
        comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                "用户月均电量最小约束", contentBeanList33));


        List<ComparisonDetailContentBean.ContentBean> contentBeanList34 = new ArrayList<>();
        for (PackageComparisonBean.Bean datum : data) {
            contentBeanList34.add(new ComparisonDetailContentBean.ContentBean(-1, datum.getUserEnergyMax()));
        }
        comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                "用户月均电量最大约束", contentBeanList34));


        List<ComparisonDetailContentBean.ContentBean> contentBeanList3 = new ArrayList<>();
        for (PackageComparisonBean.Bean datum : data) {
            contentBeanList3.add(new ComparisonDetailContentBean.ContentBean(-1, getConstrRel(datum.getConstrRel())));
        }
        comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                "是否可解约", contentBeanList3));

        List<ComparisonDetailContentBean.ContentBean> contentBeanList4 = new ArrayList<>();
        for (PackageComparisonBean.Bean datum : data) {
            contentBeanList4.add(new ComparisonDetailContentBean.ContentBean(1, getYerOrNoImgRes(datum.getConstrBarg())));
        }
        comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                "是否可议价", contentBeanList4));

        List<ComparisonDetailContentBean.ContentBean> contentBeanList5 = new ArrayList<>();
        for (PackageComparisonBean.Bean datum : data) {
            contentBeanList5.add(new ComparisonDetailContentBean.ContentBean(1, getYerOrNoImgRes(datum.getConstrMod())));
        }
        comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                "是否可调整", contentBeanList5));

        List<ComparisonDetailContentBean.ContentBean> contentBeanList6 = new ArrayList<>();
        for (PackageComparisonBean.Bean datum : data) {
            contentBeanList6.add(new ComparisonDetailContentBean.ContentBean(-1, datum.getSoldEnergy()));
        }
        comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                "商品销量", contentBeanList6));

        List<ComparisonDetailContentBean.ContentBean> contentBeanList7 = new ArrayList<>();
        for (PackageComparisonBean.Bean datum : data) {
            contentBeanList7.add(new ComparisonDetailContentBean.ContentBean(-1, datum.getCreateDate()));
        }
        comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                "上架时间", contentBeanList7));

        List<ComparisonDetailContentBean.ContentBean> contentBeanList8 = new ArrayList<>();
        for (int i = 0; i < data.size(); i++) {
            PackageComparisonBean.Bean bean = data.get(i);
            Map<String, Double> proper = (Map<String, Double>) bean.getProper();
            List<Double> list = new ArrayList<>();
            if (null != proper)
                for (Double value : proper.values()) {
                    list.add(value);
                }
            contentBeanList8.add(new ComparisonDetailContentBean.ContentBean(-1, list.size() == 0 ? "--" :
                    monthSelectIndexList.get(i) > list.size() - 1 ? "--" : BigDecimalUtils.onKeep2Decimal_new(list.get(monthSelectIndexList.get(i)) + "") + "MWh"));
        }
        comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                "库存电量", contentBeanList8));

        List<ComparisonDetailContentBean.ContentBean> contentBeanList9 = new ArrayList<>();

        for (int i = 0; i < data.size(); i++) {
            PackageComparisonBean.Bean bean = data.get(i);
            contentBeanList9.add(new ComparisonDetailContentBean.ContentBean(9, monthSelectIndexList.get(i), monthDataMap.get(bean.getCombId())));
        }

        comparisonDetailContentBeans.add(new ComparisonDetailContentBean(ComparisonDetailContentBean.CONTENT,
                "选择套餐月份", contentBeanList9));


    }


    private String getConstrRel(String str) {
//        解约条件 1 无条件  2有条件 3不可解 4 双方确认解约
        switch (str) {
            case "1":
                return "无条件";
            case "2":
                return "单方解约";
            case "3":
                return "不可解";
            case "4":
                return "双方协商解约";
            default:
                return "--";
        }
    }


    private int getYerOrNoImgRes(String str) {
        switch (str) {
            case "1":
                return R.mipmap.ic_yes;
            default:
                return R.mipmap.ic_no;
        }

    }

    //是否分时段  分时分电量01，分时不分电量02，不分时分电量03，不分时不分电量04
    private int getTime(String str) {
        switch (str) {
            case "01":
            case "02":
                return R.mipmap.ic_yes;
            default:
                return R.mipmap.ic_no;
        }

    }

    //是否约定电量  分时分电量01，分时不分电量02，不分时分电量03，不分时不分电量04
    private int getElectricity(String str) {
        switch (str) {
            case "01":
            case "03":
                return R.mipmap.ic_yes;
            default:
                return R.mipmap.ic_no;
        }

    }


    private String getPNum(String str) {
        switch (str) {
            case "1":
                return "基础价格套餐";
            case "2":
                return "组合套餐(基准套餐+浮动套餐)";
            default:
                return "--";
        }
    }


}
